//package com.wulaobo.test;
//
//import com.wulaobo.pojo.Event;
//import org.apache.flink.api.common.functions.MapFunction;
//import org.apache.flink.api.common.typeinfo.TypeHint;
//import org.apache.flink.api.java.tuple.Tuple;
//import org.apache.flink.api.java.tuple.Tuple2;
//import org.apache.flink.streaming.api.datastream.DataStreamSource;
//import org.apache.flink.streaming.api.datastream.SingleOutputStreamOperator;
//import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;
//
//public class TransReduceTest2 {
//
//    public static void main(String[] args) throws Exception {
//
//        StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
//        env.setParallelism(1);
//
//        DataStreamSource<Event> stream = env.fromElements(
//                new Event("Mary", "./home", 1000L),
//                new Event("Bob", "./prod?id=100", 2000L),
//                new Event("Alice", "./cart?id=3", 5900L),
//                new Event("Bob", "./prod?id=200", 2300L),
//                new Event("Alice", "./cart?id=1", 2100L),
//                new Event("Bob", "./prod?id=300", 2400L),
//                new Event("Alice", "./cart?id=2", 1800L),
//                new Event("Bob", "./prod?id=400", 3000L),
//                new Event("Bob", "./prod?id=400", 4000L),
//                new Event("Mary", "./home", 5000L)
//        );
//
//        SingleOutputStreamOperator<Tuple2<String, Long>> streamOperator = stream.map(new MapFunction<Event, Tuple2<String,Long>>() {
//
//            @Override
//            public Tuple2<String,Long> map(Event value) throws Exception {
//                return Tuple2.of(value.user,1L);
//            }
//        })
//                .keyBy(data -> data.f0)
//                .reduce((value1, value2) -> Tuple2.of(value1.f0, value1.f1 + value2.f1));
//
//        SingleOutputStreamOperator<Tuple2<String, Long>> reduce = streamOperator.keyBy(data -> "key")
//                .reduce((value1, value2) -> value1.f1 > value2.f1 ? value1 : value2);
//
//        reduce.print("reduce:");
//
//        env.execute();
//    }
//
//}
